# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion do
  @moduledoc """
  Describes information about a regional election administrative area.

  ## Attributes

  *   `electionAdministrationBody` (*type:* `GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrativeBody.t`, *default:* `nil`) - The election administration body for this area.
  *   `local_jurisdiction` (*type:* `GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion.t`, *default:* `nil`) - The city or county that provides election information for this voter. This object can have the same elements as state.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the jurisdiction.
  *   `sources` (*type:* `list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source.t)`, *default:* `nil`) - A list of sources for this area. If multiple sources are listed the data has been aggregated from those sources.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :electionAdministrationBody =>
            GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrativeBody.t() | nil,
          :local_jurisdiction =>
            GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion.t() | nil,
          :name => String.t() | nil,
          :sources => list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source.t()) | nil
        }

  field(:electionAdministrationBody,
    as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrativeBody
  )

  field(:local_jurisdiction,
    as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion
  )

  field(:name)
  field(:sources, as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion do
  def decode(value, options) do
    GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2AdministrationRegion do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
